<script setup>
import { useRouter, useRoute } from 'vue-router'

const router = useRouter()
const route = useRoute()

const goToLogin = () => {
  router.push('/login')
}

const goToAdmin = () => {
  router.push('/admin')
}
</script>

<template>
  <div class="front-layout">
    <el-container>
      <el-header>
        <div class="header-logo">
          <i class="fas fa-paw"></i>
          流浪动物救助平台
        </div>
        <div class="header-menu">
          <nav class="nav-links">
            <router-link to="/front" class="nav-item" :class="{ active: route.path === '/front' }">
              <i class="fas fa-home"></i> 首页
            </router-link>
            <router-link to="/front/adoption" class="nav-item" :class="{ active: route.path === '/front/adoption' }">
              <i class="fas fa-heart"></i> 领养中心
            </router-link>
            <router-link to="/front/surrender" class="nav-item" :class="{ active: route.path === '/front/surrender' }">
              <i class="fas fa-hand-holding-heart"></i> 送养申请
            </router-link>
            <router-link to="/front/donation" class="nav-item" :class="{ active: route.path === '/front/donation' }">
              <i class="fas fa-donate"></i> 爱心捐募
            </router-link>
            <router-link to="/front/profile" class="nav-item" :class="{ active: route.path === '/front/profile' }">
              <i class="fas fa-user-circle"></i> 个人中心
            </router-link>
          </nav>
        </div>
        <div class="header-actions">
          <el-button @click="goToLogin">
            <i class="fas fa-sign-in-alt"></i> 登录
          </el-button>
          <el-button type="primary" @click="goToAdmin">
            <i class="fas fa-user-shield"></i> 管理后台
          </el-button>
        </div>
      </el-header>
      
      <el-main>
        <router-view />
        
      </el-main>
      
      <el-footer>
        <p><i class="far fa-copyright"></i> 2023 流浪动物救助平台 - 版权所有</p>
      </el-footer>
    </el-container>
  </div>
</template>

<style scoped>
.front-layout {
  width: 100vw;
  min-height: 100vh;
}

.el-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.el-header {
  background-color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.header-logo {
  font-size: 20px;
  font-weight: bold;
  color: #409EFF;
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-actions {
  display: flex;
  gap: 10px;
}

.el-main {
  flex: 1;
  background-color: #f5f7fa;
  padding: 0;
}

.placeholder {
  text-align: center;
  padding: 100px 0;
  color: #909399;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.el-footer {
  background-color: #304156;
  color: #fff;
  text-align: center;
}

.header-menu {
  flex: 1;
  display: flex;
  justify-content: center;
}

.nav-links {
  display: flex;
  gap: 20px;
  align-items: center;
}

.nav-item {
  text-decoration: none;
  color: #606266;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 15px;
  border-radius: 4px;
  transition: all 0.3s;
}

.nav-item:hover {
  color: #409EFF;
  background-color: #ecf5ff;
}

.nav-item.active {
  color: #409EFF;
  background-color: #ecf5ff;
}

.nav-item i {
  margin-right: 5px;
}

.el-button i {
  margin-right: 5px;
}
</style> 